<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Admin_statistics extends Admin_Controller {
	public function __construct()
	{
		parent::Admin_Controller();
		$this->config->load('cirpho');
		$this->load->helper('form');
		$this->lang->load('cirpho');
		$this->lang->load('statistics');
		$this->load->model('cip_statistics_m');
		$this->template
			->append_metadata($this->load->view('fragments/wysiwyg', $this->data, TRUE))
			->append_metadata( css('cirpho.css', 'cirpho') )
			->set_partial('shortcuts', 'admin/partials/shortcuts');
		// Set the validation rules
		$this->load->library('form_validation');
	}
	public function index()
	{
		$this->pyrocache->delete_all('modules_m');
		// Create pagination links
		$total_rows = $this->cip_statistics_m->count_all();
		$pagination = create_pagination('admin/cirpho/statistics/index', $total_rows, NULL, 5);
		// Using this data, get the relevant results
		$statistics = $this->cip_statistics_m->getAllStatistics($pagination['limit']);
		$this->template
			->title($this->module_details['name'], lang('cirpho_statistics_list_title'))
			->set('statistics', $statistics)
			->set('pagination', $pagination)
			->build('admin/statistics/index', $this->data);
	}
}